package com.zjm.structural.composite.university;

import java.util.ArrayList;
import java.util.List;

public class Collage extends OrganizationComponent {
    List<OrganizationComponent> organizationComponents = new ArrayList<>();

    public Collage(String name, String desc) {
        super(name, desc);
    }

    /**
     * 重写add
     *
     * @param organizationComponent
     */
    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    /**
     * 重写remove
     *
     * @param organizationComponent
     */
    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDesc() {
        return super.getDesc();
    }

    /**
     * 输入大学包含的学院
     */
    @Override
    protected void print() {
        System.out.println("-------------------" + getName() + "--------------------");
        for (OrganizationComponent organizationComponent : organizationComponents) {
            organizationComponent.print();
        }
    }
}
